package com.vue.controller;

import com.alibaba.fastjson.JSONObject;
import com.vue.bean.R;
import com.vue.entity.po.LoginPO;
import com.vue.service.UserService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: wrj
 * @since: 2024/8/3 20:12
 * @description:
 */

@Slf4j
@RestController
@AllArgsConstructor
@RequestMapping("/login")
public class LoginController {

    private UserService userService;

    @GetMapping("/login")
    public R login(LoginPO po){
        try {
            log.info("登录po：{}", JSONObject.toJSON(po));
            return userService.login(po);
        } catch (Exception e) {
            return R.fail("登录异常");
        }
    }
}
